<?php
include_once  "Source.php";

$filename1  = "城主5月31号打点.csv";
$filename2  = "城主6月1打点.csv";


$data1 = getCsvData($filename1);
$num1 = count($data1);
$data2 = getCsvData($filename2);

$inter = array_intersect($data2 , $data1);
$interNum = count($inter);

$pre = $interNum / $num1;

var_dump($num1, count($data2),$interNum, $pre);


function getCsvData($filename)
{
    $list = [];
    $row = 0;
    if (($handle = fopen($filename, "r")) !== FALSE) {
        while (($data = fgetcsv($handle, 1000)) !== FALSE) {
            $num = count($data);
            $row++;
            if (1 == $row) {
                $fields = $data;
                continue;
            }

            for ($c=0; $c < $num; $c++) {
                $info[$fields[$c]] = $data[$c];
            }
            if (!isset($info['momo_id'])) var_dump($info);
            $list[$info['momo_id']] = 1;

        }
        $list  = array_keys($list);
        fclose($handle);
        return $list;
    }

}